package com.lemobar.pay.model.alipay.response;

import com.lemobar.pay.model.alipay.TradeFundBill;
import lombok.Data;

/**
 * 退款请求
 * alipay.trade.refund(统一收单交易退款接口) 响应
 * 手机网站WAP支付 https://opendocs.alipay.com/open/02ivbx
 * APP 支付 https://opendocs.alipay.com/open/02e7go
 * 付款码支付 https://opendocs.alipay.com/open/02ekfs
 */
@Data
public class AliPayTradeRefundResponse {
    /*  响应示例
    {
        "alipay_trade_refund_response": {
            "code": "10000",
            "msg": "Success",
            "trade_no": "支付宝交易号",
            "out_trade_no": "6823789339978248",
            "buyer_logon_id": "159****5620",
            "fund_change": "Y",
            "refund_fee": 88.88,
            "refund_detail_item_list": [
                {
                    "fund_channel": "ALIPAYACCOUNT",
                    "amount": 10,
                    "real_amount": 11.21,
                    "fund_type": "DEBIT_CARD"
                }
            ],
            "store_name": "望湘园联洋店",
            "buyer_user_id": "2088101117955611",
            "send_back_fee": "1.8"
        },
        "sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
    }
     */

    private AliPayTradeRefundResponse.Content alipayTradeRefundResponse;

    private String sign;

    @Data
    public static class Content {

        private String code;

        private String msg;

        private String subCode;

        private String subMsg;

        /**
         * 支付宝交易号
         */
        private String tradeNo;

        /**
         * 商家订单号
         */
        private String outTradeNo;

        /**
         * 买家支付宝账号
         */
        private String buyerLogonId;

        /**
         * 本次退款是否发生了资金变化
         */
        private String fundChange;

        /**
         * 退款总金额 单位为元
         * 该笔交易已退款的总金额
         */
        private Double refundFee;

        /**
         * 退款使用的资金渠道。
         * 只有在签约中指定需要返回资金明细，或者入参的query_options中指定时才返回该字段信息。
         */
        private TradeFundBill[] refundDetailItemList;


        /**
         * 交易在支付时候的门店名称
         */
        private String storeName;

        /**
         * 买家在支付宝的用户id
         */
        private String buyerUserId;

        /**
         * 本次商户实际退回金额。
         */
        private String sendBackFee;
    }
}
